#pragma once
using namespace std;
#include "SourceView.h"
#include "Source.h"
#include <stdlib.h> 
//class CSource;
//class SourceView;

class OceanSourceView :	public SourceView
{
public:

	OceanSourceView(void);
	~OceanSourceView(void);


	virtual void drawSource(CSource* source, CPaintDC* dc)
    { 
		CGdiObject *oldBrush = dc->SelectStockObject(DC_BRUSH);
		CGdiObject *oldPen = dc->SelectStockObject(DC_PEN);
		if(source->getState()==CSource::NORMAL_STATE)
			dc->SetDCBrushColor(RGB(0,255,0));
		else if(source->getState()==CSource::CRITICAL_STATE)
			dc->SetDCBrushColor(RGB(255,0,0));
		else if(source->getState()==CSource::WARNING_STATE)
			dc->SetDCBrushColor(RGB(255,255,0));		
		//dc->SetDCPenColor(RGB(0,0,0));
		dc->BeginPath();
		dc->MoveTo(source->getPosition()->x-10,source->getPosition()->y+10);
		dc->LineTo(source->getPosition()->x+10,source->getPosition()->y+10);
		dc->LineTo(source->getPosition()->x,source->getPosition()->y-10);
		dc->LineTo(source->getPosition()->x-10,source->getPosition()->y+10);
		dc->EndPath();
		dc->FillPath();
		//dc->Ellipse(source->getPosition()->x-10,source->getPosition()->y-10,source->getPosition()->x+10,source->getPosition()->y+10);
		dc->SelectObject(oldBrush);
		dc->SelectObject(oldPen);
		dc->TextOut(source->getPosition()->x-10, source->getPosition()->y-25, source->getName().data());
		
		 char* str = new char[30];
		 sprintf(str, "%.4g", source->getPower());  
		 char* str1= new char[30];
		 sprintf(str1, "%.i", source->getOutAmount());  
		 
		  
        dc->TextOut(source->getPosition()->x-10, source->getPosition()->y+10, str);
		dc->TextOut(source->getPosition()->x-10, source->getPosition()->y+25, str1);
		
    }
};

